﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MDV.Entities;
using System.IO;
using MDV.DataAccess;

namespace MDV.Business
{
    class Update
    {
       DataObject data = new DataObject();
       public string check = "At Business";
       public string ReadFile(string _filename)
        {
            string input = "";
            string str = "";
            try
            {
                StreamReader re = new StreamReader(_filename);               
                while ((input = re.ReadLine()) != null)
                {
                    str += input + "\n";
                }
                re.Close();
            }
            catch (Exception e)
            {
                check = e.ToString();
            }                
                return str;
        }

        public void UpdateOnDB(string fileName) {           
            data.loadData();
            data.UpdateData(ReadFile(fileName));
            check = data.check;
        }
    }
}
